<form method="post" action="{$smarty.const.HOST_ADMIN}/post-data/save-paramater" target="ifmParamater" {if $AppUI->admin_group_id==$smarty.const.GROUP_Administrator}onsubmit="return doSubmit_Category();" {else}onsubmit="return false;"{/if}>
<fieldset>
	<legend>Paramaters</legend>
	<div style="float:left">
		<h2>(A) Exponential smoothing</h2>
	</div>
	<div style="float:right">
		<a href="javascript:auto_fill(1)">Autofill for Consignment</a>
		&nbsp;|&nbsp;
		<a href="javascript:auto_fill(2)">Autofill for Outright</a>
	</div>
	<div class="clearfix"></div>
	<table width="100%">
		<tr>
			<th class="first" rowspan="2">&nbsp;</th>
			<th rowspan="2">Category</th>
			<th rowspan="2">Shippment Type</th>
			<th colspan="2" style="text-align:center; border-bottom:1px solid">Historical Sales</th>
			<th colspan="2" style="text-align:center; border-bottom:1px solid">Day to forecast</th>
		</tr>
		<tr>
			<th>From date</th>
			<th>To date</th>
			<th>Forecast days</th>
			<th>Buffer days</th>
		</tr>
		{if $arrCategory}
				{section loop=$arrCategory name=i}
				<tr>
					<td rowspan="2">{$smarty.section.i.index+1}</td>
					<td rowspan="2">
						{$arrCategory[i].name}
						<input type="hidden" name="strCategory{$smarty.section.i.index}" value="{$arrCategory[i].name}" />
					</td>
					<td>Consignment</td>
					<td>
						<input type="text" class="s_df" size="12" value="{$arrCategory[i].s_df}" name="strSaleDateFrom{$smarty.section.i.index}" id="strSaleDateFrom{$smarty.section.i.index}" onclick="return showCalendar('strSaleDateFrom{$smarty.section.i.index}', 'y-mm-dd');" />
					</td>
					<td>
						<input type="text" class="s_dt" size="12" value="{$arrCategory[i].s_dt}" name="strSaleDateTo{$smarty.section.i.index}" id="strSaleDateTo{$smarty.section.i.index}" onclick="return showCalendar('strSaleDateTo{$smarty.section.i.index}', 'y-mm-dd');" />
					</td>
					<td>
						<input type="text" class="fd" size="4" maxlength="4" value="{$arrCategory[i].fd}" name="intForecastDate{$smarty.section.i.index}" id="intForecastDate{$smarty.section.i.index}" />
					</td>
					<td>
						<input type="text" class="bd" size="4" maxlength="4" value="{$arrCategory[i].bd}" name="intBufferDate{$smarty.section.i.index}" id="intBufferDate{$smarty.section.i.index}" />
						<input type="hidden" name="intSupplierTime{$smarty.section.i.index}" value="{$arrCategory[i].sp_t}" />
					</td>
				</tr>
				<tr class="bg">
					<td>Outright</td>
					<td>
						<input type="text" class="s_df1" size="12" value="{$arrCategory[i].s_df1}" name="strSaleDateFrom1_{$smarty.section.i.index}" id="strSaleDateFrom1_{$smarty.section.i.index}" onclick="return showCalendar('strSaleDateFrom1_{$smarty.section.i.index}', 'y-mm-dd');" />
					</td>
					<td> 
						<input type="text" class="s_dt1" size="12" value="{$arrCategory[i].s_dt1}" name="strSaleDateTo1_{$smarty.section.i.index}" id="strSaleDateTo1_{$smarty.section.i.index}" onclick="return showCalendar('strSaleDateTo1_{$smarty.section.i.index}', 'y-mm-dd');" />
					</td>
					<td>
						<input type="text" class="fd1" size="4" maxlength="4" value="{$arrCategory[i].fd1}" name="intForecastDate1_{$smarty.section.i.index}" id="intForecastDate1_{$smarty.section.i.index}" />
					</td>
					<td>
						<input type="text" class="bd1" size="4" maxlength="4" value="{$arrCategory[i].bd1}" name="intBufferDate1_{$smarty.section.i.index}" id="intBufferDate1_{$smarty.section.i.index}" />
						<input type="hidden" name="intSupplierTime1_{$smarty.section.i.index}" value="{$arrCategory[i].sp_t1}" />
					</td>
				</tr>
				{/section}
		 </table>
		 <br />
		 <h2>(B) Weighted Moving Average</h2>
		 <table>
			    <th width="100px">Paramater</th>
				<th width="100px">Data</th>
				<tr>
					<td>W1</td>
					<td >
					    <input type="text" size="4" maxlength="4" name="w1" value="{$arrParamT.w1}" /> 
					</td>
				</tr>
				<tr>
					<td >W2</td>
					<td>
						 <input type="text" size="4" maxlength="4" name="w2" value="{$arrParamT.w2}" />
					</td>
				</tr>
				<tr>
					<td>W3</td>
					<td>
						<input type="text" size="4" maxlength="4" name="w3" value="{$arrParamT.w3}" />
					</td>
				</tr>
				<tr>
					<td>W4</td>
					<td>
						<input type="text" size="4" maxlength="4" name="w4" value="{$arrParamT.w4}" /> 
					</td>
				</tr>
		</table>
	{else}
		<table>
			<tr>
				<td colspan="99"><em>Sale data is not uploaded.</em></td>
			</tr>
		</table>
	 {/if}
	
	{if $arrCategory && $AppUI->admin_group_id==$smarty.const.GROUP_Administrator}
	<p align="center">
		<input type="submit" value="Save Paramater" class="bt" />
		<input type="hidden" name="intTotalCate" value="{$intTotalCate}" />
	</p>
	{/if}
</fieldset>
</form>
<iframe name="ifmParamater" id="ifmParamater" width="100%" style="display:none"></iframe>
{literal}
<script type="text/javascript">
	function auto_fill(v)
	{
		if(v=='1' || v==1)
		{
			var s_df	= $('#strSaleDateFrom0').val();
			$('.s_df').val(s_df);
			
			var s_dt	= $('#strSaleDateTo0').val();
			$('.s_dt').val(s_dt);
			
			var fd		= $('#intForecastDate0').val();
			$('.fd').val(fd);
			
			var bd		= $('#intBufferDate0').val();
			$('.bd').val(bd);
		}
		else if(v=='2' || v==2)
		{
			var s_df	= $('#strSaleDateFrom1_0').val();
			$('.s_df1').val(s_df);
			
			var s_dt	= $('#strSaleDateTo1_0').val();
			$('.s_dt1').val(s_dt);
			
			var fd	= $('#intForecastDate1_0').val();
			$('.fd1').val(fd);
			
			var bd	= $('#intBufferDate1_0').val();
			$('.bd1').val(bd);
		}
	}
</script>
{/literal}